package com.twu.biblioteca.actions;

import com.twu.biblioteca.controller.LibraryController;
import com.twu.biblioteca.controller.LoginController;
import com.twu.biblioteca.domain.Book;
import com.twu.biblioteca.domain.Movie;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BibliotechaCommandFactoryImpl implements BibliotechaCommandsFactory {
    private final LibraryController<Book> bookController;
    private final LibraryController<Movie> movieController;
    private final LoginController loginController;

    public BibliotechaCommandFactoryImpl(LibraryController<Book> bookController, LibraryController<Movie> movieController, LoginController loginController){
        this.bookController = bookController;
        this.movieController = movieController;
        this.loginController = loginController;
    }

    @Override
    public Map<String, BibliotechaCommand> getActions() {
        return new HashMap<String, BibliotechaCommand>(){{
            put("showdetails", new ShowDetailsCommand(loginController));
            put("list", new ListItemsCommand<Book>(bookController));
            put("listmovies", new ListItemsCommand<Movie>(movieController));
            put("withdrawbook", new WithdrawItemCommand<Book>(bookController));
            put("withdrawmovie", new WithdrawItemCommand<Movie>(movieController));
            put("listwithdrawn", new ListWithdrawnCommand<Book>(bookController));
            put("returnbook", new ReturnItemCommand<Book>(bookController));
            put("returnmovie", new ReturnItemCommand<Movie>(movieController));
        }};
    }
}
